<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>公务员平时考核系统-个人信息</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="static/css/font.css">
    <link rel="stylesheet" href="static/css/xadmin.css">
    <link rel="stylesheet" href="static/lib/layui/css/layui.css">
    <style type="text/css">
        .layui-table-cell {
            height: auto;
            line-height: 30px;
            padding: auto;
            position: relative;
            overflow: hidden;
            text-overflow: ellipsis;
            box-sizing: border-box;
            font-size: 15px;
            white-space: normal;
        / / nowrap = 不换行 normal = 正常
        }

    </style>
</head>
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a>首页</a>
        <a>个人信息</a>
        <a>
          <cite>信息详情</cite></a>
      </span><!---->
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="employee-info-container">
    <blockquote class="layui-elem-quote">个人信息</blockquote>
    <div class="my-flex-row">
        <div class="employee-info-container-left">
            <div class="employee-info-row">
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">工号</span>
                    <div class="layui-input-inline">
                        <input type="text" id="eAccount" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>

                </div>
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">姓名</span>
                    <div class="layui-input-inline">
                        <input type="text" id="eName" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>
                </div>
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">性别</span>
                    <div class="layui-input-inline">
                        <input type="text" id="eSex" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>
                </div>
            </div>
            <div class="employee-info-row" style="margin-bottom: 0;">
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">部门</span>
                    <div class="layui-input-inline">
                        <input type="text" id="dName" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>

                </div>
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">岗位</span>
                    <div class="layui-input-inline">
                        <input type="text" id="pName" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>
                </div>
                <div class="employee-info-row-item">
                    <span class="employee-info-row-item-name">职称</span>
                    <div class="layui-input-inline">
                        <input type="text" id="rankName" class="layui-input  employee-info-row-item-input" disabled
                               value=""/>
                    </div>
                </div>
            </div>
        </div>
        <div class="employee-info-img">
            <img src="" id="eHeadPath" height="150" width="110"/>
        </div>
    </div>
    <br>
    <blockquote class="layui-elem-quote">联系方式</blockquote>
    <div class="employee-info-modify">
        <form class="layui-form">
            <div class="my-flex-row">
                <div class="employee-info-container-left">
                    <div class="employee-info-row">
                        <div class="employee-info-row-item">
                            <span class="employee-info-row-item-name">手机号码</span>
                            <div class="layui-input-inline">
                                <input type="text" id="ePhone" class="layui-input  employee-info-row-item-input"
                                       value=""/>
                            </div>

                        </div>
                        <div class="employee-info-row-item">
                            <span class="employee-info-row-item-name">邮箱地址</span>
                            <div class="layui-input-inline">
                                <input type="text" id="eEmail" class="layui-input  employee-info-row-item-input"
                                       value=""/>
                            </div>
                        </div>
                        <div class="employee-info-modify-button">
                            <button class="layui-btn" lay-submit lay-filter="updateInfo"> 保存修改</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <blockquote class="layui-elem-quote">岗位工作任务</blockquote>
    <table class="layui-table"
           id="jobResponsibilities"
           lay-data="{height: 'full-250', cellMinWidth:580, url:'responsibility/getPositionRespInfo.do', page:false, id:'idTest'}"
           lay-filter="demo"
    >
        <thead>
        <th
                lay-data="{field:'dName', templet: '<span>{{d.position.pName}}</span>',width:150, align: 'center'}">岗位
        </th>
        <th
                lay-data="{field:'rContent', templet: '<span>{{d.respment.rContent}}</span>' ,minWidth:110,align: 'left',}">
            工作任务
        </th>
        <th
                lay-data="{title:'操作', width:110, align: 'center', toolbar: '#editButton'}">操作
        </th>
        </thead>
    </table>
    <br>
</div>


</body>

<style>
    .employee-info-table {
        width: 100%;
    }

    .employee-info-input {
        width: 100%;
    }

    .employee-info-container {
        padding: 16px;
    }

    .employee-info-container-left:last-child {
        margin-bottom: 0;
    }

    .my-flex-row {
        display: flex;
        flex-direction: row;
        align-items: center;

        /*flex-grow: 0;*/
        /*flex-shrink: 0;*/
    }

    .employee-info-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: left;

        margin-bottom: 1.5rem;
    }

    .employee-info-row-item {
        margin-right: 5rem;
    }

    .employee-info-row-item-name {
        display: inline-block;
        margin-right: 1rem;
        min-width: 4rem;
    }

    .employee-info-row-item-input {
        width: 17rem;
    }

    .employee-info-modify {
        margin-top: 2rem;
    }

    .job-responsibility {
        line-height: 1.5rem;
        marigin: 0 auto;
    }

    .employee-info-row-job {
        line-height: 1.5rem;
        margin-left: auto;
        margin-right: auto;
    }

</style>

<script type="text/html" id="editButton">
    <a class="layui-btn" lay-event="edit">编辑</a>
</script>

<script type="text/javascript" src="static/js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="static/lib/layui/layui.js"></script>
<script type="text/javascript" src="static/js/xadmin.js"></script>
<script>
    var dRemark = null;
    var pDuty = null;
    window.onload = function () {
        $.ajax({
            url: "inforEmployee.do",
            type: "get",
            dataType: "json",
            success: function (data) {
                var employee = data.employee;
                var rankBonus = data.rankBonus;
                var position = data.position;
                var department = data.department;
                $("#eBasePay").val(employee.eBasePay);
                $("#eAccount").val(employee.eAccount);
                $("#eEmail").val(employee.eEmail);
                $("#eEntryTime").val(employee.eEntryTime)
                $("#eBirthday").val(employee.eBirthday)
                $("#eHometown").val(employee.eHometown)
                $("#eDagree").val(employee.eDagree)
                $("#eIdcard").val(employee.eIdcard)
                $("#eName").val(employee.eName)
                $("#ePhone").val(employee.ePhone)
                $("#dName").val(department.dName)
                $("#pName").val(position.pName)
                $("#rankName").val(rankBonus.rankName)
                $("#eSex").val(employee.eSex)
                $("#eUrgentPerson").val(employee.eUrgentPerson)
                $("#eUrgentPhone").val(employee.eUrgentPhone)
                $("#eHeadPath").attr('src', employee.eHeadPath)
                dRemark = department.dRemark;
                pDuty = position.pDuty;
            },
        })
    }

    function getPosition() {
        //页面层
        layer.open({
            title: ['岗位描述',
                'background:#EFEFEF; color:#000;'],
            type: 1,
            // skin: 'layui-layer-rim', //加上边框
            area: ['420px', '240px'], //宽高
            content: dRemark
        });
    }

    function getDepartment() {
        //页面层
        layer.open({
            title: ['部门介绍',
                'background:#EFEFEF; color:#000;'],
            type: 1,
            // skin: 'layui-layer-rim', //加上边框
            area: ['420px', '240px'], //宽高
            content: pDuty
        });
    }

    // 预先加载
    layui.use('form', function () {
        // 注册变量
        var form = layui.form;

        //监听提交form里面的submit标签
        form.on('submit(updateInfo)', function (data) {
            $.ajax({
                url: "updateInforEmployee.do",
                data: {
                    "eEmail": $("#eEmail").val(),
                    "eUrgentPerson": $("#eUrgentPerson").val(),
                    "eUrgentPhone": $("#eUrgentPhone").val(),
                    "eHometown": $("#eHometown").val(),
                    "ePhone": $("#ePhone").val()
                },
                type: "post",
                dataType: "json",
                success: function (result) {
                    if (result.code == 100) {
                        layer.alert("个人信息修改成功", {title: "操作提示"})
                    } else {
                        layer.alert(result.message, {title: "操作提示"})
                    }
                },
            })
            return false;
        });
    });


    layui.use(['util', 'layedit', 'laydate', 'table'], function () {
        var form = layui.form
            , util = layui.util
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate
            , table = layui.table;

        $('.demoTable .layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

        function relo() {
            var wFlag = $('#wFlag');
            var wFinshLivel = $('#wFinshLivel');
            // 执行重载
            table.reload('idTest', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                , where: {
                    w_flag: wFlag.val(),
                    w_finshLivel: wFinshLivel.val()
                }
            });
        }
    })

    // 监听职责修改
    layui.use('table', function () {
        let table = layui.table;
        table.on('tool(demo)', function (obj) {
            let data = obj.data;
            let content = data.respment.rContent;
            content = content.replace(/<br\s*\/?>/gi, "\r\n");
            let id = data.respment.rId;
            let newLayer = layer.open({
                type: 1,
                area: ['900px', '600px'], //宽高
                title: '修改岗位职责',
                content: '<div style="padding: 2rem; text-align: center"> <h2>岗位职责</h2> <br/> <textarea id="newContent" rows="20" style="width: 100%; font-size: 1rem;"></textarea> ' +
                    '<div style="margin-top: 1rem; text-align: right;">' +
                    '<button class="layui-btn layui-btn-primary" id="cancelButton"> 取消 </button> ' +
                    '<button class="layui-btn" id="okButton"> 确定 </button>' +
                    '</div>' +
                    '</div>'
            });
            $('#newContent').html(content);
            $('#cancelButton').click(() => {
                let tmpLayer = layer.confirm('确认取消编辑？', {
                    btn: ['返回', '确认'] //按钮
                }, function () {
                    layer.close(tmpLayer);
                }, function () {
                    layer.close(newLayer);
                });
            })
            $('#okButton').click(() => {
                let tmpLayer = layer.confirm('确认提交？', {
                    btn: ['返回', '确认'] //按钮
                }, function () {
                    layer.close(tmpLayer);
                }, function () {
                    let newContent = $("#newContent").val();
                    $.ajax({
                        url: "responsibility/updatePosResp.do",
                        data: {
                            "id": id,
                            "content": newContent,
                        },
                        type: "post",
                        dataType: "json",
                        success: function (result) {
                            if (result.code == 100) {
                                layer.alert("岗位工作任务修改成功", {title: "操作提示"})
                                table.reload('idTest', {
                                    url: 'responsibility/getPositionRespInfo.do'
                                    , where: {} //设定异步数据接口的额外参数
                                });
                                layer.close(newLayer);

                            } else {
                                layer.alert(result.message, {title: "操作提示"})
                            }
                        },
                    })
                });

            });
        })
    })

</script>
</html>
